<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .list li:nth-child(1) {
            color: red;
        }

        .list li:nth-child(2) {
            color: green;
        }

        .list li:nth-child(3) {
            color: yellow;
        } */

        .list li {
            color: red;
        }


        .list li:nth-child(3n) {
            color: black;
        }


        /* .list li:nth-child(2n) {
            background-color: pink;
        } */

        .list li:nth-child(even) {
            background-color: pink;
        }



        /* .list li:nth-child(2n+1) {
            background-color: skyblue;
        } */
        .list li:nth-child(odd) {
            background-color: skyblue;
        }



        .list li:first-child{
            background-color: blue;
        }

         .list li:last-child{
            background-color: blue;
        }

        .box p:nth-child(3) {
            color: red;
        }


        .box p:nth-of-type(2) {
            color: blue;
        }
    </style>
</head>

<body>


    <ul class="list">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>


    <div class="box">
        <p>111</p>
        <h3>222</h3>
        <p>3333</p>
        <h1>111</h1>
    </div>

</body>

</html>